package com.gitee.wsl.doc.prosemirror.state.bookmark

import com.gitee.wsl.doc.prosemirror.model.node.Node
import com.gitee.wsl.doc.prosemirror.state.selection.TextSelection
import com.gitee.wsl.doc.prosemirror.transform.map.Mappable

class TextBookmark(val anchor: Int, val head: Int) : SelectionBookmark {
    override fun map(mapping: Mappable) = TextBookmark(mapping.map(this.anchor), mapping.map(this.head))
    override fun resolve(doc: Node) = TextSelection.between(doc.resolve(this.anchor), doc.resolve(this.head))
}